1になっているビットの数を数える (popcount)
Hamming weight, the number of non-zero entries ('1' bits) in a byte, string, word, array or other similar data structure
1になっているビットの数を数えることをいう
Python
方法はいろいろあるが、個人的には以下が好み
code:py
bin(10).count('1')
参考
C++
__builtin_popcount()ってのがある